package abstracttransactions


import (
	"salary-payment/Model"
	"salary-payment/DataBase"
)
type AddEmployeeTransaction struct{
	AddEmployeeTransactioner
	itsEmpid int
	itsName string
	itsAddress string
}

type AddEmployeeTransactioner interface{
	GetClassification() model.PaymentClassification
	GetSchedule() model.PaymentSchedule
}

func (add AddEmployeeTransaction) NewAddEmployeeTransaction(empid int,name string,address string){
	add.itsEmpid = empid
	add.itsName = name
	add.itsAddress = address

}

func (add AddEmployeeTransaction) Execute(){
	pc := add.GetClassification()
	ps := add.GetSchedule()
	pm := modelimplementation.HoldMethod{}
	e := model.Employee{}.Employee(add.itsEmpid,add.itsName,add.itsAddress)
	e.SetClassification(pc)
	e.SetSchedule(ps)
	e.SetMethod(pm)
	database.PayrollDatabase{}.AddEmployee(add.itsEmpid,&e)
}